package user

import (
	"regexp"
)

type Email struct {
	email string
	valid bool
}

func NewEmail(email string) *Email {
	return &Email{
		email: email,
	}
}

func (e *Email) GetEmail() string {
	return e.email
}

func (e *Email) IsValid() bool {
	pattern := `^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$`
	match, _ := regexp.MatchString(pattern, e.email)
	return match
}
